<!DOCTYPE html>
<html lang="en"  xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>添加用户</title>
    <link rel="stylesheet" href="../../../../component/pear/css/pear.css" />
</head>
<body>
<form class="layui-form" action="">
    <div class="mainBox">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">档案编号</label>
                <div class="layui-input-block">
                    <input type="text" name="docNum"  value="" lay-verify="title" autocomplete="off" placeholder="请输入" class="layui-input">
                </div>
            </div>

        </div>

        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">姓名</label>
                <div class="layui-input-block">
                    <input type="text" name="patientName" value=""   lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">年龄</label>
                <div class="layui-input-block">
                    <input type="number" name="patientAge"  value="" autocomplete="off" placeholder="请输入" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">照片上传</label>
                <div class="layui-input-block">
                    <input type="text" name="patientPic" value=""  autocomplete="off" placeholder="请输入" class="layui-input">
                </div>
            </div>
<!--            <div class="layui-upload">-->
<!--                <button type="button" class="layui-btn" id="test1">照片上传</button>-->
<!--                <div class="layui-upload-list">-->
<!--                    <img class="layui-upload-img" id="patientPic" style="width: 200px;height: 150px">-->
<!--                    <p id="demoText"></p>-->
<!--                </div>-->
<!--            </div>-->
        </div>

        <div class="layui-form-item">
            <div class="layui-form-item">
                <label class="layui-form-label">性别</label>
                <div class="layui-input-block">
                    <input type="radio" name="patientSex" value="1" title="男" checked>
                    <input type="radio" name="patientSex" value="0" title="女">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">联系电话</label>
                <div class="layui-input-block">
                    <input type="text" name="patientTel" value=""  autocomplete="off" placeholder="请输入" class="layui-input">
                </div>
            </div>

        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">证件类型</label>
                <div class="layui-input-block">
                    <input type="text" name="cardType"  value=""  placeholder="请输入" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">证件号</label>
                <div class="layui-input-block">
                    <input type="text" name="cardNum" value=""  autocomplete="off" placeholder="请输入" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">出生日期</label>
                <div class="layui-input-block">
                    <input type="date" name="birth" value=""  lay-verify="required" autocomplete="off" placeholder="请输入" class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">现住地址</label>
                <div class="layui-input-block">
                    <input type="text" name="address"   value=""  placeholder="请输入" autocomplete="off" class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">民族</label>
                <div class="layui-input-block">
                    <input type="text" name="ethnic"  value=""   placeholder="请输入" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">籍贯</label>
                <div class="layui-input-block">
                    <input type="text" name="origin"  value="" autocomplete="off" placeholder="请输入" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">婚姻状况</label>
                <div class="layui-input-block">
                    <input type="text" name="wedStatus" value=""  autocomplete="off" placeholder="请输入" class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">户口地址</label>
                <div class="layui-input-block">
                    <input type="text" name="accountAddress" value=""    placeholder="请输入" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">社保类型</label>
                <div class="layui-input-block">
                    <input type="text" name="socialSecuritytype" value=""   autocomplete="off" placeholder="请输入" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">社保卡号</label>
                <div class="layui-input-block">
                    <input type="text" name="socialSecuritynum" value=""  autocomplete="off" placeholder="请输入" class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">经济来源</label>
                <div class="layui-input-block">
                    <input type="text" name="financialFrom"  value=""  placeholder="请输入" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">付费方式</label>
                <div class="layui-input-block">
                    <input type="text" name="payWay" value=""  autocomplete="off" placeholder="请输入" class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">紧急联系人</label>
                <div class="layui-input-block">
                    <input type="text" name="emergencyContacts"  value=""   placeholder="请输入" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">紧急电话</label>
                <div class="layui-input-block">
                    <input type="text" name="emergencyTel" value=""  autocomplete="off" placeholder="请输入" class="layui-input">
                </div>
            </div>

        </div>

    </div>
        </div>
    </div>
    <div class="bottom">
        <div class="button-container">
            <button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit="" lay-filter="user-save">
                <i class="layui-icon layui-icon-ok"></i>
                提交
            </button>
            <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">
                <i class="layui-icon layui-icon-refresh"></i>
                重置
            </button>
        </div>
    </div>
</form>
<script src="../../../../component/layui/layui.js"></script>
<script src="../../../../component/pear/pear.js"></script>
<script>
    layui.use(['form','jquery'],function(){
        let form = layui.form;
        let $ = layui.jquery;

        form.on('submit(user-save)', function(data){

          console.log(data.field)
            $.ajax({
                url:'http://localhost:8080/oldinfo/add',
                headers: {
                    token: localStorage.getItem("token")
                },
                data:data.field,
                type:'post',
                beforeSend: function (xhr) {
                    xhr.setRequestHeader('token', localStorage.getItem("token"));
                },
                success:function(result){
                    console.log(data);
                    if(result.code==0){
                        layer.msg(result.msg,{icon:1,time:1000},function(){
                            parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
                            parent.location.reload(); //数据刷新
                        });
                    }else{
                        console.log(result);
                        layer.msg(result.msg,{icon:2,time:1000});
                    }
                }
            })

            console.log(localStorage.getItem("token"))
            return false;
        });
    })
</script>
<script>
</script>
</body>
</html>